package cn.richard.demo.drools.starter;

import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@ConditionalOnProperty(prefix = "app.drools",name = "enable", havingValue = "true")
@EnableConfigurationProperties(AppDroolsConfigProperties.class)
@Configuration
public class AppDroolsAutoConfiguration {
	
	@Bean
	@ConditionalOnMissingBean(KieUtilService.class)
	public KieUtilService getKieUtilService() {
		
		return new KieUtilService();
	}
}
